/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Ondrej
 */
@Entity
@Table(name = "working_block")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "WorkingBlock.findAll", query = "SELECT w FROM WorkingBlock w"),
    @NamedQuery(name = "WorkingBlock.findById", query = "SELECT w FROM WorkingBlock w WHERE w.id = :id"),
    @NamedQuery(name = "WorkingBlock.findByFromDate", query = "SELECT w FROM WorkingBlock w WHERE w.fromDate = :fromDate"),
    @NamedQuery(name = "WorkingBlock.findByToDate", query = "SELECT w FROM WorkingBlock w WHERE w.toDate = :toDate"),
    @NamedQuery(name = "WorkingBlock.findByDescription", query = "SELECT w FROM WorkingBlock w WHERE w.description = :description"),
    @NamedQuery(name = "WorkingBlock.findByActiveFrom", query = "SELECT w FROM WorkingBlock w WHERE w.activeFrom = :activeFrom"),
    @NamedQuery(name = "WorkingBlock.findByActiveTo", query = "SELECT w FROM WorkingBlock w WHERE w.activeTo = :activeTo")})
public class WorkingBlock implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "from_date")
    private Integer fromDate;
    @Column(name = "to_date")
    private Integer toDate;
    @Size(max = 400)
    @Column(name = "description")
    private String description;
    @Column(name = "active_from")
    private Integer activeFrom;
    @Column(name = "active_to")
    private Integer activeTo;
    @JoinColumn(name = "WORKING_BLOCK_CATEGORY_id", referencedColumnName = "id")
    @ManyToOne
    private WorkingBlockCategory wORKINGBLOCKCATEGORYid;
    @JoinColumn(name = "PROJECT_id", referencedColumnName = "id")
    @ManyToOne
    private Project pROJECTid;
    @JoinColumn(name = "EMPLOYEE_id", referencedColumnName = "id")
    @ManyToOne
    private Employee eMPLOYEEid;

    public WorkingBlock() {
    }

    public WorkingBlock(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getFromDate() {
        return fromDate;
    }

    public void setFromDate(Integer fromDate) {
        this.fromDate = fromDate;
    }

    public Integer getToDate() {
        return toDate;
    }

    public void setToDate(Integer toDate) {
        this.toDate = toDate;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getActiveFrom() {
        return activeFrom;
    }

    public void setActiveFrom(Integer activeFrom) {
        this.activeFrom = activeFrom;
    }

    public Integer getActiveTo() {
        return activeTo;
    }

    public void setActiveTo(Integer activeTo) {
        this.activeTo = activeTo;
    }

    public WorkingBlockCategory getWORKINGBLOCKCATEGORYid() {
        return wORKINGBLOCKCATEGORYid;
    }

    public void setWORKINGBLOCKCATEGORYid(WorkingBlockCategory wORKINGBLOCKCATEGORYid) {
        this.wORKINGBLOCKCATEGORYid = wORKINGBLOCKCATEGORYid;
    }

    public Project getPROJECTid() {
        return pROJECTid;
    }

    public void setPROJECTid(Project pROJECTid) {
        this.pROJECTid = pROJECTid;
    }

    public Employee getEMPLOYEEid() {
        return eMPLOYEEid;
    }

    public void setEMPLOYEEid(Employee eMPLOYEEid) {
        this.eMPLOYEEid = eMPLOYEEid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof WorkingBlock)) {
            return false;
        }
        WorkingBlock other = (WorkingBlock) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.entities.WorkingBlock[ id=" + id + " ]";
    }
    
}
